package com.hsurosy.hsuchain.nft;

import com.hsurosy.hsuchain.nft.api.chain.service.ChainFacadeService;
import com.hsurosy.hsuchain.nft.api.collection.service.CollectionFacadeService;
import com.hsurosy.hsuchain.nft.api.goods.service.GoodsFacadeService;
import com.hsurosy.hsuchain.nft.api.order.OrderFacadeService;
import com.hsurosy.hsuchain.nft.api.pay.service.PayFacadeService;
import com.hsurosy.hsuchain.nft.api.user.service.UserFacadeService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Dubbo服务配置类
 *
 * @Author Hsu琛君珩
 * @Date 2024-10-05 16:45
 * @Description
 * @Version: v1.0.0
 */
@Configuration
public class BusinessDubboConfiguration {

    /**
     * 引用链上操作的Facade服务，版本为1.0.0
     */
    @DubboReference(version = "1.0.0")
    private ChainFacadeService chainFacadeService;

    /**
     * 引用订单操作的Facade服务，版本为1.0.0
     */
    @DubboReference(version = "1.0.0")
    private OrderFacadeService orderFacadeService;

    /**
     * 引用支付操作的Facade服务，版本为1.0.0
     */
    @DubboReference(version = "1.0.0")
    private PayFacadeService payFacadeService;

    /**
     * 引用用户操作的Facade服务，版本为1.0.0
     */
    @DubboReference(version = "1.0.0")
    private UserFacadeService userFacadeService;

    /**
     * 引用收藏品操作的Facade服务，版本为1.0.0
     */
    @DubboReference(version = "1.0.0")
    private CollectionFacadeService collectionFacadeService;

    /**
     * 引用商品操作的Facade服务，版本为1.0.0
     */
    @DubboReference(version = "1.0.0")
    private GoodsFacadeService goodsFacadeService;

    /**
     * 提供收藏品Facade服务的Bean
     *
     * @return CollectionFacadeService实例
     */
    @Bean
    @ConditionalOnMissingBean(name = "collectionFacadeService")
    public CollectionFacadeService collectionFacadeService() {
        return collectionFacadeService;
    }

    /**
     * 提供用户Facade服务的Bean
     *
     * @return UserFacadeService实例
     */
    @Bean
    @ConditionalOnMissingBean(name = "userFacadeService")
    public UserFacadeService userFacadeService() {
        return userFacadeService;
    }

    /**
     * 提供支付Facade服务的Bean
     *
     * @return PayFacadeService实例
     */
    @Bean
    @ConditionalOnMissingBean(name = "payFacadeService")
    public PayFacadeService payFacadeService() {
        return payFacadeService;
    }

    /**
     * 提供订单Facade服务的Bean
     *
     * @return OrderFacadeService实例
     */
    @Bean
    @ConditionalOnMissingBean(name = "orderFacadeService")
    public OrderFacadeService orderFacadeService() {
        return orderFacadeService;
    }

    /**
     * 提供链上操作Facade服务的Bean
     *
     * @return ChainFacadeService实例
     */
    @Bean
    @ConditionalOnMissingBean(name = "chainFacadeService")
    public ChainFacadeService chainFacadeService() {
        return chainFacadeService;
    }

    /**
     * 提供商品Facade服务的Bean
     *
     * @return GoodsFacadeService实例
     */
    @Bean
    @ConditionalOnMissingBean(name = "goodsFacadeService")
    public GoodsFacadeService goodsFacadeService() {
        return goodsFacadeService;
    }
}
